/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.DeliveryUserReward;
import org.apache.ibatis.jdbc.SQL;

public class DeliveryUserRewardSqlProvider {

    /* @mbggenerated */
    public String insertSelective(DeliveryUserReward record) {
        return new SQL() {{
            INSERT_INTO("delivery_user_reward");

            if (record.getId() != null)

            {
                VALUES("id", "#{id,jdbcType=INTEGER}");
            }

            if (record.getUserId() != null)

            {
                VALUES("user_id", "#{userId,jdbcType=INTEGER}");
            }

            if (record.getRewardMoney() != null)

            {
                VALUES("reward_money", "#{rewardMoney,jdbcType=INTEGER}");
            }

            if (record.getRewardReason() != null)

            {
                VALUES("reward_reason", "#{rewardReason,jdbcType=VARCHAR}");
            }

            if (record.getRelationId() != null)

            {
                VALUES("relation_id", "#{relationId,jdbcType=INTEGER}");
            }

            if (record.getRewardFrom() != null)

            {
                VALUES("reward_from", "#{rewardFrom,jdbcType=TINYINT}");
            }

            if (record.getWechatOrdNo() != null)

            {
                VALUES("wechat_ord_no", "#{wechatOrdNo,jdbcType=VARCHAR}");
            }

            if (record.getCreateTime() != null)

            {
                VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
            }

        }}.toString();
    }

    /* @mbggenerated */
    public String updateByPrimaryKeySelective(DeliveryUserReward record) {
        return new SQL() {
            {
                UPDATE("delivery_user_reward");

                if (record.getUserId() != null) {
                    SET("user_id = #{userId,jdbcType=INTEGER}");
                }

                if (record.getRewardMoney() != null) {
                    SET("reward_money = #{rewardMoney,jdbcType=INTEGER}");
                }

                if (record.getRewardReason() != null) {
                    SET("reward_reason = #{rewardReason,jdbcType=VARCHAR}");
                }

                if (record.getRelationId() != null) {
                    SET("relation_id = #{relationId,jdbcType=INTEGER}");
                }

                if (record.getRewardFrom() != null) {
                    SET("reward_from = #{rewardFrom,jdbcType=TINYINT}");
                }

                if (record.getWechatOrdNo() != null) {
                    SET("wechat_ord_no = #{wechatOrdNo,jdbcType=VARCHAR}");
                }

                if (record.getCreateTime() != null) {
                    SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
                }

                WHERE("id = #{id,jdbcType=INTEGER}");

            }
        }.toString();
    }
}